
lombo-drm-y +=	lombo_drv.o lombo_framebuffer.o lombo_fb_sc.o lombo_fb_array.o \
		lombo_crtc.o lombo_subdrv.o lombo_scale.o
obj-$(CONFIG_DRM_LOMBO) += lombo-drm.o

ifeq ($(CONFIG_ARCH_LOMBO_N7V1), y)
CSP_PLATFORM := n7v1
else
CSP_PLATFORM := n9v1
endif

# to support csp_dpu_top to lib
CSP_DPU_SOURCE := $(srctree)/$(src)/csp/csp_dpu_top.c
CSP_DPU_SOURCE += $(srctree)/$(src)/csp/csp_dpu_common.c

ifneq ($(TARGET_TOOLS_PREFIX), arm-ez-linux-uclibcgnueabihf-)
uclibc_prefix:=
else
uclibc_prefix:=uclibc/
endif

ifneq ($(wildcard $(CSP_DPU_SOURCE)), )
obj-$(CONFIG_DRM_LOMBO_DPU_TOP) += csp/
else
obj-$(CONFIG_DRM_LOMBO_DPU_TOP) += liblombo_dpu_top.o liblombo_dpu_common.o liblombo_dpu_csc.o

$(obj)/liblombo_dpu_top.o: $(src)/csp/$(uclibc_prefix)liblombo_dpu_top
	cp $< $@
$(obj)/liblombo_dpu_common.o: $(src)/csp/$(uclibc_prefix)liblombo_dpu_common
	cp $< $@
$(obj)/liblombo_dpu_csc.o: $(src)/csp/$(uclibc_prefix)liblombo_csc
	cp $< $@
endif
lombo-dpu-y += lombo_dpu.o
obj-$(CONFIG_DRM_LOMBO_DPU_TOP) += lombo-dpu.o

# to support csp_dpu_dc to lib
CSP_DPU_DC_SOURCE := $(srctree)/$(src)/csp/csp_dpu_dc.c

ifneq ($(wildcard $(CSP_DPU_DC_SOURCE)), )
obj-$(CONFIG_DRM_LOMBO_DC) += csp/
else
obj-$(CONFIG_DRM_LOMBO_DC) += liblombo_dpu_dc.o
$(obj)/liblombo_dpu_dc.o: $(src)/csp/$(uclibc_prefix)liblombo_dpu_dc
	cp $< $@
endif
lombo-dc-y += lombo_dc.o lombo_dc_win.o lombo_dc_blk.o
obj-$(CONFIG_DRM_LOMBO_DC) += lombo-dc.o

# to support csp_dpu_ove to lib
CSP_DPU_OVE_SOURCE := $(srctree)/$(src)/csp/csp_dpu_ove.c

ifneq ($(wildcard $(CSP_DPU_OVE_SOURCE)), )
obj-$(CONFIG_DRM_LOMBO_OVE) += csp/
else
obj-$(CONFIG_DRM_LOMBO_OVE) += liblombo_dpu_ove.o
$(obj)/liblombo_dpu_ove.o: $(src)/csp/$(uclibc_prefix)liblombo_dpu_ove
	cp $< $@
endif
lombo-ove-y += lombo_ove.o
obj-$(CONFIG_DRM_LOMBO_OVE) += lombo-ove.o

# to support csp_dpu_se to lib
CSP_DPU_SE_SOURCE := $(srctree)/$(src)/csp/csp_dpu_se.c \
	$(srctree)/$(src)/csp/csp_csc.c

ifneq ($(wildcard $(CSP_DPU_SE_SOURCE)), )
obj-$(CONFIG_DRM_LOMBO_SE) += csp/
else
obj-$(CONFIG_DRM_LOMBO_SE) += liblombo_dpu_se.o
$(obj)/liblombo_dpu_se.o: $(src)/csp/$(uclibc_prefix)liblombo_dpu_se
	cp $< $@
endif
lombo-se-y += lombo_se.o
obj-$(CONFIG_DRM_LOMBO_SE) += lombo-se.o

# to support csp_dpu_wb to lib
CSP_DPU_WB_SOURCE := $(srctree)/$(src)/csp/csp_dpu_wb.c \
	$(srctree)/$(src)/csp/csp_csc.c

ifneq ($(wildcard $(CSP_DPU_WB_SOURCE)), )
obj-$(CONFIG_DRM_LOMBO_WB) += csp/
else
obj-$(CONFIG_DRM_LOMBO_WB) += liblombo_dpu_wb.o
$(obj)/liblombo_dpu_wb.o: $(src)/csp/$(uclibc_prefix)liblombo_dpu_wb
	cp $< $@
endif
lombo-wb-y += lombo_wb.o
obj-$(CONFIG_DRM_LOMBO_WB) += lombo-wb.o

# to support csp_doss_top to lib
CSP_DOSS_SOURCE := $(srctree)/$(src)/csp/csp_doss_top.c

ifneq ($(wildcard $(CSP_DOSS_SOURCE)), )
obj-$(CONFIG_DRM_LOMBO_DOSS_TOP) += csp/
else
obj-$(CONFIG_DRM_LOMBO_DOSS_TOP) += liblombo_doss_top.o
$(obj)/liblombo_doss_top.o: $(src)/csp/$(uclibc_prefix)liblombo_doss_top
	cp $< $@
endif
lombo-doss-y += lombo_doss.o
obj-$(CONFIG_DRM_LOMBO_DOSS_TOP) += lombo-doss.o

lombo-vo-manage-y += lombo_vo_manage.o
obj-$(CONFIG_DRM_LOMBO_VO) += lombo-vo-manage.o

# to support csp_doss_tcon to lib
CSP_DOSS_TCON_SOURCE := $(srctree)/$(src)/csp/csp_doss_tcon.c

ifneq ($(wildcard $(CSP_DOSS_TCON_SOURCE)), )
obj-$(CONFIG_DRM_LOMBO_TCON) += csp/
else
obj-$(CONFIG_DRM_LOMBO_TCON) += liblombo_doss_tcon.o
$(obj)/liblombo_doss_tcon.o: $(src)/csp/$(uclibc_prefix)liblombo_doss_tcon
	cp $< $@
endif
lombo-tcon-y += lombo_tcon.o lombo_rgb.o
obj-$(CONFIG_DRM_LOMBO_TCON) += lombo-tcon.o

# to support csp_mipi_dsi to lib
CSP_DSI_SOURCE := $(srctree)/$(src)/csp/$(CSP_PLATFORM)/dsi/csp_doss_mipi_dsi.c

ifneq ($(wildcard $(CSP_DSI_SOURCE)), )
obj-$(CONFIG_DRM_LOMBO_MIPI_DSI) += csp/$(CSP_PLATFORM)/dsi/
else
obj-$(CONFIG_DRM_LOMBO_MIPI_DSI) += liblombo_mipi_dsi.o
$(obj)/liblombo_mipi_dsi.o: $(src)/csp/$(CSP_PLATFORM)/dsi/$(uclibc_prefix)liblombo_mipi_dsi
	cp $< $@
endif
lombo-mipi-dsi-y += lombo_mipi_dsi.o
obj-$(CONFIG_DRM_LOMBO_MIPI_DSI) += lombo-mipi-dsi.o

# to support csp_vgss_top to lib
CSP_VGSS_SOURCE := $(srctree)/$(src)/csp/csp_vgss_top.c

ifneq ($(wildcard $(CSP_VGSS_SOURCE)), )
obj-$(CONFIG_DRM_LOMBO_VGSS_TOP) += csp/
else
obj-$(CONFIG_DRM_LOMBO_VGSS_TOP) += liblombo_vgss_top.o
$(obj)/liblombo_vgss_top.o: $(src)/csp/$(uclibc_prefix)liblombo_vgss_top
	cp $< $@
endif
lombo-vgss-y += lombo_vgss.o
obj-$(CONFIG_DRM_LOMBO_VGSS_TOP) += lombo-vgss.o

# to support csp_vgss_rot to lib
CSP_VGSS_ROT_SOURCE := $(srctree)/$(src)/csp/csp_vgss_rot.c

ifneq ($(wildcard $(CSP_VGSS_ROT_SOURCE)), )
obj-$(CONFIG_DRM_LOMBO_ROT) += csp/
else
obj-$(CONFIG_DRM_LOMBO_ROT) += liblombo_vgss_rot.o
$(obj)/liblombo_vgss_rot.o: $(src)/csp/$(uclibc_prefix)liblombo_vgss_rot
	cp $< $@
endif
lombo-rot-y += lombo_rot.o
obj-$(CONFIG_DRM_LOMBO_ROT) += lombo-rot.o

